package main

import "fmt"

// 三种~for循环的方式
func main() {

	//fmt.Println("请输入一个数字：")
	//var num int
	//fmt.Scanln(&num)
	//test01(num)
	//test02(num)
	//test03(num)
	test0208()

}

func test01(num int) {
	for i := 0; i < num; i++ {
		fmt.Println("HELLO WORLD test01= ", i)
	}
	fmt.Println()
}

func test02(num int) {
	var i int = 0
	for i < num {
		fmt.Println("HELLO WORLD test02= ", i)
		i++
	}
	fmt.Println()
}
func test03(num int) {
	var i int = 0
	for {
		if i < num {
			fmt.Println("HELLO WORLD test03= ", i)
			i++
		} else {
			break
		}
	}
}

func test0208() {
	for i := 0; i < 10; i++ {
		fmt.Println("HELLO WORLD FOR-I= ", i)
	}

	var i int = 0
	for i < 10 {
		fmt.Println("HELLO WORLD FOR-EXPRESS= ", i)
		i++
	}

	for {
		if i < 10 {
			fmt.Println("HELLO WORLD FOR--- = ", i)
			i++
		} else {
			break
		}
	}
	var str string = "hello world"
	for _, v := range str {
		fmt.Printf("HELLO WORLD FOR-RANGE= %c \n", v)
	}
}
